home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PBLIB1 / PROGS / TPRINT.DOC < prev    next >
Text File  |  1994-01-05  |  9KB  |  252 lines

  1. \space 20
  2. \CENTER on
  3. TPRINT PROGRAM DOCUMENTATION
  4.  
  5. (and test file)
  6. \space 20
  7.  
  8. \CENTER off
  9.  
  10.                                            Howard Richoux
  11.                                            6721 Shamrock Rd.
  12.                                            Lincoln, NE  68506-2821
  13.                                            (402) 488-5867
  14.  
  15. \HEADER1 '@LABEL1|@FILE|Page @PAGE'
  16. \header2 ' '
  17. \new
  18. \CENTER TPRINT 3.00
  19. \join
  20.  
  21.      This program is an old-fashioned, command based text
  22. processor.  Formatting commands are placed in the clear in the
  23. text file, rather than hidden as invisible character sequences.
  24. One of the benefits is that you can see exactly what formatting is
  25. going to be done.  Also, it is pretty easy to generate some of these
  26. commands programatically, in report programs, and use the output for
  27. multiple purposes.
  28.  
  29.      Please examine the source for this documentation print-out
  30. because I am trying to exercise as many aspects of the program as
  31. possible.  Also, some of the functions were added to TPRINT simply to
  32. exercise various parts of the code library.  The BOX drawing stuff
  33. on the next page isn't really useful, but it needed exercise.
  34.  
  35. \join off
  36. Commands:
  37. \indent 10
  38. OFFSET n        -  left margin for everything         ( 0 - 20 )
  39. INDENT n        -  Sets an additional offset for text ( 0 - 20 )
  40. CENTER ON/OFF   -  Centers all lines from ON to OFF
  41. CENTER text     -  Centers this text
  42. SPACE n         -  Writes n blank lines
  43. NEW             -  Goes to new page
  44. TRIGGER n       -  n is the decimal equivalent of an ASCII char
  45.                    default is backslash (92)
  46. \indent 0
  47.  
  48. Headers and Footers:
  49. \indent 10
  50. HEADERn 'spec'  -  Sets a new header specification (details later)
  51. FOOTERn 'spec'  -  Sets a new footer specification (details later)
  52. \indent 0
  53.  
  54. Special Commands:  (Debugging)
  55. \indent 10
  56. DEBUG ON/OFF    -  Sets a flag for program to print intermediate steps
  57. ECHO ON/OFF     -  Echoes the TPRINT commands encountered
  58. \indent 0
  59. \join
  60.  
  61.  
  62.      These are typically set in a TPRINT.CFG file.  There are (optionally)
  63. two of these files.  The first resides on the same directory as the
  64. TPRINT.EXE file.  This would be used to hold general defaults, which
  65. will apply to all uses of the program.  These can be overridden by a
  66. TPRINT.CFG on the current directory.  Even these can be overridden by
  67. placing the same thing on the command line following the file name.  This
  68. same nested configuration file applies to most utilities I write.  It
  69. costs 5-10k in code size, but the added flexibility is extremely useful.
  70. Because of the way it is implemented, you could duplicate TPRINT.exe as
  71. TPRINT2.exe(or xyz.exe), change parameters in the TPRINT2.cfg files and have
  72. a very different program.
  73.  
  74.  
  75. \HEADER1 '@LABEL1|Quoted Strings Section|Page @PAGE'
  76. \NEW
  77. \CENTER TPRINT Headers and Footers
  78.  
  79.      With any kind of luck, the header at the top of the page had
  80. the center portion replaced.  The specification for the top page header
  81. was:
  82.      HEADER1 '@LABEL1|Quoted Strings Section|Page @PAGE'
  83.  
  84. Pages are laid out as follows:
  85.                      Default Specification
  86.      HEADER1         '@LABEL1|@FILE|'
  87.      HEADER2         ' '
  88.      HEADER3         ''
  89.      <text>
  90.      FOOTER2         ''
  91.      FOOTER1         '||Page @PAGE'
  92.  
  93.      A specification is of the form:  '<spec>|<spec>|<spec3>' where
  94. the specs define the left, center and right portions respectively.  The
  95. left section is left justified, the right section is right justified, and
  96. the center section is centered, the '|' are invisible.  These vary by the
  97. defined page width.
  98.  
  99.      The currently defined elements for headers and footers are as
  100. follows:
  101. \JOIN OFF
  102. \INDENT 10
  103.  
  104. @DATE     - current date as mm/dd/yy
  105. @TIME     - current time as hh:mm
  106. @DTIME    - date and time as mm/dd/yy hh:mm
  107. @PAGE     - current page number
  108. @PROGID   - program ID of program making listing
  109. @FILE     - current file being operated on
  110. @LABEL1   - TPRINT defines as datetime of current file
  111. @LABEL2   - undefined - set with param
  112. @LABEL3   - undefined - set with param
  113.    Anything else is treated as literal characters and printed in the
  114. appropriate place.
  115.  
  116. \INDENT 0
  117. \JOIN ON
  118.      This group of variables is not random and is implemented in the
  119. OUT_object level 1.  Any program using the level 1 OUT_object can use these.
  120. It is simple to add other variables, but since this is a rather low level
  121. in the program, code added to the list object will propagate to most other
  122. programs using the object.  The DOS unit code added to the OUT_object was the
  123. reason that the @FDATE variable (date time of current file) was removed from
  124. the OUT_object and added to the TPRINT program.  Similarly, the OUT_object was
  125. divided into 2 levels to save about 5k of code for programs not needing headers,
  126. footers, word-wrap and the like.  Both levels provide the basic interchangeability
  127. between console, printer and text file.
  128.  
  129. \HEADER1 '@LABEL1|@FILE|'
  130. \HEADER2 ' '
  131. \NEW
  132.  
  133.      The JOIN command initiates a word-wrap function until turned off.
  134. this ignores the end of lines in the source text, and wraps the text at
  135. blank spaces in the words.
  136.  
  137.      This isn't perfect, but allows some page formatting.
  138. Blocks are terminated at a blank line.  Here is the same text re-done with
  139. a JOIN 40 (and an INDENT 10) to make a 40 char wide column.
  140.  
  141. \INDENT 10
  142. \JOIN 40
  143.  
  144.      The JOIN command initiates a word-wrap function until turned off.
  145. this ignores the end of lines in the source text, and wraps the text at
  146. blank spaces in the words.
  147.  
  148.      This isn't perfect, but allows some page formatting.
  149. Blocks are terminated at a blank line.  Here is the same text re-done with
  150. a JOIN 40 to make a 40 char wide column.
  151.  
  152. \JOIN
  153. \INDENT 0
  154.  
  155.      You will notice that JOINing is not a very sophisticated word
  156. wrapping, it just backs off to the blank prior to overflowing the
  157. set width.  The above section set at a width of 40 averages about
  158. 35 characters per line, because the 5 or 6 character word has to
  159. be pushed down to the next line.  The full page width join is a little
  160. more effective.
  161.  
  162.  
  163. \NEW
  164. \center Sourcing Other Text Files
  165.  
  166. \JOIN
  167.  
  168.      The SOURCE command allows a second level of files to be read and
  169. merged into a single document.  At present, only 2 levels are allowed, so
  170. SOURCE commands in sourced in files are ignored.
  171. You can also SOURCE sections of a text file.  A section is defined (for
  172. other programs as well) as a portion of a text file beginning with
  173. a string (starting at col 1) I will call a section tag (secttag in code)
  174. such as: "\SECTION" or "?sect".  The compiled in default is "{SECTION"
  175. and this can be overrridden using the parameter SECTTAG='xx...xx' in the
  176. various CFG files or command line.   The next portion of the section line
  177. is treated as a section name, and needs to be followed by at least one blank
  178. to be recognized.  The section ends at the next section tag or at the
  179. end of file.   Note: the sourced text will start on a new line.
  180.  
  181. Here is source from another file (\source tprint1.doc):
  182. \join off
  183. \source tprint1.doc
  184. Back to tprint.doc
  185.  
  186. Now, just one section (\source tprint1.doc(two) ):
  187. \source tprint1.doc(two)
  188. Back to tprint.doc
  189.  
  190.  
  191.  
  192. \JOIN OFF
  193. \INDENT 0
  194.  
  195. \NEW
  196. \CENTER TPRINT Box Commands
  197.  
  198.      This is a reasonable, though not too elegant, method of adding
  199. line drawing commands to your text.  The trigger character is the <tilde>
  200. ASCII 126.  You use them like quote marks to bracket characters you want
  201. converted to line draw characters.  Since TPRINT is printing this document,
  202. I will replace the <tilde>s on this page with <hat>s (^).
  203.  
  204. This:
  205. \JOIN OFF
  206. \INDENT 10
  207.  
  208.                        This is a Box
  209.  
  210. Everything         ^L---------M-------R^     Mnemonics:
  211. outside            ^|         |       |^     L = Upper Left
  212. the                ^|         |       |^     M = Upper Middle
  213. squiggles          ^|         |       |^     R = Upper Right
  214. is normal          ^S---------+-------s^     S = Left Side
  215. text.              ^|         |       |^     + = center
  216.                    ^|         |       |^     s = right side
  217.                    ^|         |       |^     l = lower left
  218.                    ^l---------m-------r^     m = lover middle
  219.                                              r = lower right
  220.                    ^1222222222222222223^
  221.  
  222.  
  223. \INDENT 0
  224.  
  225. Becomes:
  226.  
  227. \INDENT 10
  228.                        This is a Box
  229.  
  230. Everything         ~L---------M-------R~     Mnemonics:
  231. outside            ~|         |       |~     L = Upper Left
  232. the                ~|         |       |~     M = Upper Middle
  233. squiggles          ~|         |       |~     R = Upper Right
  234. is normal          ~S---------+-------s~     S = Left Side
  235. text.              ~|         |       |~     + = center
  236.                    ~|         |       |~     s = right side
  237.                    ~|         |       |~     l = lower left
  238.                    ~l---------m-------r~     m = lover middle
  239.                                              r = lower right
  240.                    ~1222222222222222223~
  241.  
  242. The digits provide some of the other characters:
  243.  
  244.                 ^1234567890^
  245.       becomes   ~1234567890~
  246.  
  247. Hmmm... I guess I didn't implement them the way I thought, ...  better go
  248. back and see.
  249.  
  250. \INDENT 0
  251.  
  252. THE END